{% extends "main/index.html" %}

{% block title %}
    <title>Approve documents</title>
{% endblock %}
{% block content %}

    <div class="titulo_contenedor">
	Approve list
    </div>
    <div class="cuerpo_contenedor" style="text-align: left;">
	<form method="post" action="/approve/" >
		{% if message%}
		<p>{{message}}</p>
		{% endif %}
		{% if results_user%}
		    <p>
			Usuario: 
			<select name="user">
			    <option value="-1">Indiferente</option>
			    {% for user in results_user %}
				<option value="{{user.NIC}}">{{user.username}}</option>
			    {% endfor %}
			</select>   
		    <br/>
			Document num:<input type="text" name="document_nro">
		    </p>
		    <p>
			<input name="cmdAceptar" value="Find" type="submit"  class="boton_1">
		    </p>
		{% endif %}
	    </form>
	    
	    <form method="post" action="" >    
		<br><br>
		{% if documents %}
		    <table>
			<tr>
			    <th>Owner</th>
			    <th>Num</th>
			    <th>Date</th>
			    <th>View</th>
			    <th>Approve</th>
			    <th>Re-Edit</th>
			    <th>Disapprove</th>
			</tr>

			{% for document in documents%}
			<tr>
			    <td>{{document.owner}}</td>
			    <td>{{document.numDoc}}</td>
			    <td>{{document.Date}}</td>
			    <td> <a href="/documents/view_document/{{document.numDoc}}/comments">View</a></td>
			    <td> <a href="/approve/approve/{{document.id}}">Approve</a></td>
			    <td> <a href="/approve/edit/{{document.id}}">Re-edit</a></td>
			    <td> <a href="/approve/disapprove/{{document.id}}">Disapprove</a></td>
			</tr>
			{% endfor %}
		    </table>
		    {% else %}
			<p>
			    No Documents.
			</p>
		    {% endif %}
		</form>
	</div>
	<div class="fondo_contenedor">
	</div>
{% endblock %}
